package modele;
import java.awt.Color;

public class Equation3D 
{
	private float x1,x2,x3,partieDroite;
	private String operateur;
	private Color couleur;
	private boolean cochee;
	private String libelle;
	public static String DEFAUT = "defaut";
	
	public Equation3D(float x1,float x2,float x3,String operateur,float partieDroite,Color couleur,String libelle)
	{
		this.x1 = x1;
		this.x2 = x2;
		this.x3 = x3;
		this.operateur = operateur;
		this.partieDroite = partieDroite;
		this.couleur = couleur;
		this.cochee = true;
		this.libelle = libelle;
	}
	
	public float getX1()
	{
		return x1;
	}
	
	public float getX2()
	{
		return x2;
	}
	
	public float getX3()
	{
		return x3;
	}
	
	public String getVariable(String var)
	{
		float f = 0;
		if(var.equals("x1"))
		{
			f = x1;
		}
		if(var.equals("x2"))
		{
			f = x2;
		}
		if(var.equals("x3"))
		{
			f = x3;
		}
		if(var.equals("partieD"))
		{
			f = partieDroite;
		}
		return Float.toString(f);
	}
	
	public String getOperateur()
	{
		return operateur;
	}
	
	public String getOperateurXML()
	{
		String s = "";
		if(operateur.equals("<="))
		{
			s = "INF_EQ";
		}
		if(operateur.equals(">="))
		{
			s = "SUP_EQ";
		}
		return s;
	}
	
	public float getPartieDroite()
	{
		return partieDroite;
	}
	
	public Color getCouleur()
	{
		return couleur;
	}
	
	public String getLibelle()
	{
		return libelle;
	}
	
	public boolean getCochee()
	{
		return cochee;
	}
	
	public void setX1(float x1)
	{
		this.x1 = x1;
	}
	
	public void setX2(float x2)
	{
		this.x2 = x2;
	}
	
	public void setX3(float x3)
	{
		this.x3 = x3;
	}
	
	public void setOperateur(String operateur)
	{
		this.operateur = operateur;
	}
	
	public void setPartieDroite(float partieDroite)
	{
		this.partieDroite = partieDroite;
	}	
	
	public void setCouleur(Color couleur)
	{
		this.couleur = couleur;
	}	
	
	public void setCochee(boolean cochee)
	{
		this.cochee = cochee;
	}	
	
	public void setLibelle(String libelle)
	{
		this.libelle = libelle;
	}
	
	public String toString()
	{
		String s = "";
		
		if((this.x1 != 0.0) && (this.x2 == 0.0) && (this.x3 == 0.0))
		{
				s += this.x1 + "x1";
		}	
		
		if((this.x1 == 0.0) && (this.x2 != 0.0) && (this.x3 == 0.0))
		{
				s += this.x2 + "x2";
		}	
		
		if((this.x1 == 0.0) && (this.x2 == 0.0) && (this.x3 != 0.0))
		{
				s += this.x3 + "x3";
		}	
		
		if((this.x1 != 0.0) && (this.x2 != 0.0) && (this.x3 == 0.0))
		{
				s += this.x1 + "x1 +" + this.x2 + "x2 ";
		}
		
		if((this.x1 != 0.0) && (this.x2 == 0.0) && (this.x3 != 0.0))
		{
				s += this.x1 + "x1 +" + this.x3 + "x3 ";
		}
		
		if((this.x1 == 0.0) && (this.x2 != 0.0) && (this.x3 != 0.0))
		{
				s += this.x2 + "x2 +" + this.x3 + "x3 ";
		}
		
		if((this.x1 != 0.0) && (this.x2 != 0.0) && (this.x3 != 0.0))
		{
			s += this.x1 + "x1 + " + this.x2 + "x2 + " + this.x3 + "x3 ";
		}	
		
		s += this.operateur + " " + this.partieDroite;		
		return s;
	}
}
